<template>
  <div>
    <searchBar placeHolder='请输入市代名称'
               @handleSearch='init' />
    <el-table :data="tableData">
      <el-table-column align="center"
                       label="订单编号"
                       prop="odd_number">
      </el-table-column>
      <el-table-column align="center"
                       label="市代名称"
                       prop="company">
      </el-table-column>
      <el-table-column align="center"
                       label="联系电话"
                       prop="phone">
      </el-table-column>
      <el-table-column align="center"
                       label="负责人"
                       prop="leader">
      </el-table-column>
      <el-table-column align="center"
                       label="提现金额"
                       prop="money">
      </el-table-column>
      <el-table-column align="center"
                       label="申请时间"
                       prop="create_time">
      </el-table-column>
      <el-table-column align="center"
                       label="驳回时间"
                       prop="audit_time">
      </el-table-column>
      <el-table-column align="center"
                       label="驳回理由">
        <template slot-scope="scope">
          <el-popover placement="bottom"
                      width="160"
                      trigger="hover"
                      :content="scope.row.reason">
            <el-button slot="reference"
                       type="text"
                       size="small"
                       class="ellipsis">{{scope.row.reason}}</el-button>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column align="center"
                       label="审核人"
                       prop="audit_person">
      </el-table-column>
    </el-table>

    <v-pagination :total='total'
                  :page.sync='page'
                  @pagination='init' />
  </div>
</template>

<script>
export default {
  data () {
    return {
      tableData: [],
      total: 0, //总页数
      page: 1,//当前页 
    }
  },
  methods: {
    async init (data) {
      try {
        const res = await this.api.cityAgent_rejectList(Object.assign({}, data, { page: this.page, key: data && data.search }))
        this.tableData = res.data.list || []
        this.total = res.data.rows || 0
      } catch (err) {
        console.log(err)
        this.$message.error('接口报错,请联系管理员')
      }
    }
  },
  mounted () {
    this.init()
  }
}
</script>

<style scoped lang='scss'>
</style>
